//
//  HXDiscountMoreTCell.m
//  ZCooking
//
//  Created by 韩旭 on 16/9/14.
//  Copyright © 2016年 HX_. All rights reserved.
//

#import "HXDiscountMoreTCell.h"
#import "HX_Macro.h"
#import "HXDiscountMoreCCell.h"
#import "HXRelatesModel.h"
#import "HXDishesModel.h"
#import "HXCustomVideoModel.h"
@implementation HXDiscountMoreTCell
- (void)setRelateArr:(NSMutableArray *)relateArr {
    _relateArr = relateArr;
    [_collectionView reloadData];
}
- (void)setUp {
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.scrollDirection = 0;
    self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
    _collectionView.delegate = self;
    ;
    _collectionView.dataSource = self;
    self.collectionView.delegate = self;
    [self.contentView addSubview:_collectionView];
    [_collectionView registerNib:[UINib nibWithNibName:@"HXDiscountMoreCCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"HXDiscountMoreCCell"];
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.relateArr.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    HXDiscountMoreCCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HXDiscountMoreCCell" forIndexPath:indexPath];
    cell.relateModel = self.relateArr[indexPath.row];
    cell.backgroundColor = COLORAUTO;
    return cell;
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
    return 0;
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
    return 0;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    return CGSizeMake(self.collectionView.HX_width / 3, self.collectionView.HX_height);
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.collectionView.frame = CGRectMake(0, 0, self.contentView.HX_width, self.contentView.HX_height);
}
@end
